﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;

namespace Jim.SHR;

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
public partial class WSOSFWebserviceFacadeSrvProxyClient : System.ServiceModel.ClientBase<WSOSFWebserviceFacadeSrvProxy>, WSOSFWebserviceFacadeSrvProxy
{

    /// <summary>
    /// 实现此分部方法，配置服务终结点。
    /// </summary>
    /// <param name="serviceEndpoint">要配置的终结点</param>
    /// <param name="clientCredentials">客户端凭据</param>
    static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

    public WSOSFWebserviceFacadeSrvProxyClient() :
            base(WSOSFWebserviceFacadeSrvProxyClient.GetDefaultBinding(), WSOSFWebserviceFacadeSrvProxyClient.GetDefaultEndpointAddress())
    {
        this.Endpoint.Name = EndpointConfiguration.WSOSFWebserviceFacade.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public WSOSFWebserviceFacadeSrvProxyClient(EndpointConfiguration endpointConfiguration) :
            base(WSOSFWebserviceFacadeSrvProxyClient.GetBindingForEndpoint(endpointConfiguration), WSOSFWebserviceFacadeSrvProxyClient.GetEndpointAddress(endpointConfiguration))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public WSOSFWebserviceFacadeSrvProxyClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
            base(WSOSFWebserviceFacadeSrvProxyClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public WSOSFWebserviceFacadeSrvProxyClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
            base(WSOSFWebserviceFacadeSrvProxyClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
    {
        this.Endpoint.Name = endpointConfiguration.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

    public WSOSFWebserviceFacadeSrvProxyClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
            base(binding, remoteAddress)
    {
    }

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    System.Threading.Tasks.Task<proceedOSFResponse> WSOSFWebserviceFacadeSrvProxy.proceedOSFAsync(proceedOSFRequest request)
    {
        return base.Channel.proceedOSFAsync(request);
    }

    public System.Threading.Tasks.Task<proceedOSFResponse> proceedOSFAsync(string serviceName, string param)
    {
        proceedOSFRequest inValue = new proceedOSFRequest();
        inValue.serviceName = serviceName;
        inValue.param = param;
        return ((WSOSFWebserviceFacadeSrvProxy)(this)).proceedOSFAsync(inValue);
    }

    public virtual System.Threading.Tasks.Task OpenAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
    }

    public virtual System.Threading.Tasks.Task CloseAsync()
    {
        return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
    }

    private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.WSOSFWebserviceFacade))
        {
            System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
            result.MaxBufferSize = int.MaxValue;
            result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
            result.MaxReceivedMessageSize = int.MaxValue;
            result.AllowCookies = true;
            return result;
        }
        throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
    }

    private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.WSOSFWebserviceFacade))
        {
            return new System.ServiceModel.EndpointAddress("http://192.168.80.20:8080/ormrpc/services/WSOSFWebserviceFacade");
        }
        throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
    }

    private static System.ServiceModel.Channels.Binding GetDefaultBinding()
    {
        return WSOSFWebserviceFacadeSrvProxyClient.GetBindingForEndpoint(EndpointConfiguration.WSOSFWebserviceFacade);
    }

    private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
    {
        return WSOSFWebserviceFacadeSrvProxyClient.GetEndpointAddress(EndpointConfiguration.WSOSFWebserviceFacade);
    }

    public enum EndpointConfiguration
    {

        WSOSFWebserviceFacade,
    }
}
